package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.pojo.MallKeyword;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.WxKeyWordsVO;
import com.cskaoyan.service.WxSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Chunlai
 * @description:
 * @time: 2021/7/12 21:55
 */
@RestController
@RequestMapping("wx/search")
public class WxSearchController {

    @Autowired
    WxSearchService wxSearchService;


    @GetMapping("index")
    public BaseRespVo index(){
        WxKeyWordsVO wordsVO = wxSearchService.querymessages();
        return BaseRespVo.ok(wordsVO);
    }
    @PostMapping("clearhistory")
    public BaseRespVo clearhistory(){
        wxSearchService.updatehistorystatus();
        return BaseRespVo.ok();
    }

    @GetMapping("helper")
    public BaseRespVo helper(String keyword){
        List<String> stringList = wxSearchService.helper(keyword);
        return BaseRespVo.ok(stringList);
    }

}